<?php
class Config {
	private $data = array();

	public function __construct($cfg = array()) {
		$this->data = $cfg;
	}
	
  	public function get($key, $default = null) {
    	return (isset($this->data[$key]) ? $this->data[$key] : $default);
  	}
	
	public function set($key, $value) {
    	$this->data[$key] = $value;
  	}

	public function has($key) {
    	return isset($this->data[$key]);
  	}

  	public function load($filename) {
		$file = DIR_CONFIG . $filename . '.php';
		
    	if (file_exists($file)) { 
	  		$_ = array();
	  
	  		require(VQMod::modCheck($file));
	  
	  		$this->data = array_merge($this->data, $_);
		} else {
			$this->log->write('Error: Could not load config ' . $filename . '!');
		}
  	}
}
?>